# /usr/bin/python
# coding: utf-8
import re


def checkField(origin, target):
    list = [','.join(map(str, t)) for t in target]
    return origin in list


def writeFile(fileName, data, *msg):
    f = open(fileName, 'w')
    for value in msg:
        f.writelines(value + '\n')
    f.write(data)
    f.close()


def checkIdCard(id):
    r = r'^([1-9]\d{5}[12]\d{3}(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])\d{3}[0-9xX])$'
    return re.findall(r, id)
